<?php
error_reporting("E_ALL");ini_set("display_errors", 1);
$getdata=$_REQUEST;
if(empty($getdata))$getdata=$_POST?$_POST:$_GET;
$type=empty($getdata['type'])?'':$getdata['type'];
include("include/function.php");
//header("content-Type: application/json; charset=utf-8");
$config = include("config.php");
include("include/".$config['DB_TYPE'].".class.php");
$db = new db;
$db->connect($config['DB_HOST'],$config['DB_USER'],$config['DB_PWD'],$config['DB_NAME'], $config['DB_PCONNECT']);
$sql = "select * from hema_school where mch_id<>'' and applet_id>10002";
$list = $db->get_all($sql);$sqlarr=[];
foreach($list as $k=>$v){
    $data=[];
    $data[]="mch_id='".$v['mch_id']."'";
    $data[]="mch_name='".$v['mch_name']."'";
    if(!empty($v['company_name']))$data[]="company_name='".$v['company_name']."'";
    if(!empty($v['bank_name']))$data[]="bank_name='".$v['bank_name']."'";
    if(!empty($v['bank_sn']))$data[]="bank_sn='".$v['bank_sn']."'";
    $sqlarr[] = "update hema_school set ".implode(',',$data)." where school_id=".$v['school_id'].";";
}

//echo count($sqlarr)."\n";
echo implode("\n",$sqlarr);
?>